package com.acme.bankapp.domain.bank;

import java.util.ArrayList;

import com.acme.bankapp.exceptions.bank.ClientExistsException;
import com.acme.bankapp.exceptions.bank.NotEnoughFundsException;

public class Client {
	private ArrayList<Account> accounts = new ArrayList<>();
	private String name;
	private Gender gender;
	

	
	Client(String name, Gender gender,int ... initialValueAndOverDraft) throws IllegalArgumentException{
		this.name = name;
		this.gender = gender;
		
		if(initialValueAndOverDraft.length == 1){
			Account a = new SavingsAccount(initialValueAndOverDraft[0]);
			accounts.add(a);
		}
		else if(initialValueAndOverDraft.length == 2){
			Account a = new CheckingAccount(initialValueAndOverDraft[0],
					initialValueAndOverDraft[1]);
			accounts.add(a);
		}
		else{
			throw new IllegalArgumentException("One or two arguments are needed!");
		}

	}
	
	public String getName(){
		return name;
	}
	
	public String getGender(){
		return gender.getString();
	}
	
	public ArrayList<Account> getAccounts(){
		return accounts;
	}
	
	public void getClientSalutation(){
		System.out.print(gender.getString() + name);
	}
}
